package com.example.myapplication.adapter;


import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

/**
 * fragment 适配器加载类
 */
public class MainPagerAdapter extends FragmentPagerAdapter {

 private List<Fragment> fragments;
 public MainPagerAdapter(FragmentManager fm,List<Fragment> fragments){
     super(fm);
     this.fragments=fragments;
 }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }
}
